package com.rongke.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.rongke.mapper.MessageMapper;
import com.rongke.model.Message;
import com.rongke.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @MessageServiceImpl
 * @消息ServiceImpl
 * @version : Ver 1.0
 */
@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {

    @Autowired
    private MessageMapper messageMapper;

    /**
     * @根据条件查找消息
     * @param message
     * @return
     */
    @Override
    public List<Message> selectByCondition(Message message) {
        return messageMapper.selectByCondition(message);
    }

    @Override
    public Message selectTemplateMsgByMsgType(int msgType) {
        EntityWrapper<Message> ew=new EntityWrapper<>();
        ew.eq("message_type",msgType);
        Message msg=this.selectOne(ew);
        return msg;
    }
}
